import java.util.Scanner;
import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2025-03-09
 * Time: 20:16
 */
public class test3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if(stack.isEmpty()||stack.peek()!=c){
                stack.push(c);
            }else if(stack.peek()==c){
                stack.pop();
            }
        }
        if(stack.isEmpty()){
            System.out.println(0);
        }else {
            int size=stack.size();
            char[] chars = new char[size];
            for (int i = 0; i < size; i++) {
                chars[i] = stack.pop();
            }
            for(int i=size-1;i>=0;i--){
                System.out.print(chars[i]);
            }


        }

    }
}
